import pygame;
import spyral;
import Dic;

class Health(spyral.sprite.Sprite):
    def __init__(self, player):
        spyral.sprite.Sprite.__init__(self);
        self.health = player.getHealth();
        self.image = spyral.util.new_surface(300, 100);
        self.heart = spyral.util.load_image(Dic.images['heart']);
        self.player = player;
        
        self.pos = (630, 10)
        self.layer = 3;
        
    
    def updateHealth(self):
        self.health = self.player.getHealth();
        self.drawHealth();
    
    def drawHealth(self):
        self.image.fill(0)
        for i in xrange(self.health):
            self.image.blit(self.heart, (200 - (i * 100), 0))


